package com.yadang.api;


import com.yadang.service.BondLendHandleMsgFactory;
import com.yadang.service.DefaultHandleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController("/bond/lend/msg")
public class BondLendApi {
    @Autowired
    private DefaultHandleService defaultHandleService;
    @Autowired
    private BondLendHandleMsgFactory bondLendHandleMsgFactory;

    @PostMapping("/sendMsg")
    public String sendMsg(String msg) {
        String source = "cfets";
        String type = "bondLb";
        DefaultHandleService handle = bondLendHandleMsgFactory.handle(source, type, "");
        String resultMsg = handle.handleMsg(source, type);

        defaultHandleService.returnMsg(resultMsg);
        return "";
    }

    public static void main(String[] args) {
        BondLendApi bondLendApi = new BondLendApi();
        String resultMsg = bondLendApi.sendMsg("");
        System.out.println(resultMsg);
    }
}
